Tweak materials and attributesΒΆ

Override a material

Most of the time you start working from a base RenderGraph (like the default graph that comes with a new RenderGraph) and add it other branches according your needs. Adding branches to the main trunk is usually done using a special type of node that perfoms a binary operation on two incoming branches (or attributes flows) and returns a new attributes flow.

Let's assign a plastic material for the sphere and keep the matte for the plane. We will use the override Binop node.

  1. Use the Plastic material of the library.
  2. Drill down into the previous NewRenderGraph.
  3. Create a Tag node, a Plastic material node, a binop.override node and connect them as in the graph below.
  4. Select the Tag node and type 'sphere' in the Tag text box of a properties view.
  5. Render the image.

The sphere is now rendered with a white shiny plastic material.

This RenderGraph can be explained like this :

The Tag node sphere selects the sphere in the scene, since its Tag is sphere and and the sphere primitive owns this tag. The Tag node is connected to the Shader node, which assign the Plastic material to the selection, since its Mode is 'Set Material' and Shader is Plastic. The Plastic node is connected to the Binop override node and overrides the Matte shader assignation, since there is an active shader assignation coming in X. Etc, ...

You can inspect which branches are active for a node. In the case of a sphere you can see that both branches are active. In the case of the plane, only the first branch is active and there is no attributes flow that can override the Matte material.

Tweak a material

Let's change the color of the plastic material to a bluish color, as well as its roughness. This is done using an MaterialOverride node. The MaterialOverride node is able to modify any exposed value of a Material, in our case, the Albedo color and Roughness of the Plastic material.

  1. Drill down into the previous NewRenderGraph.
  2. Create a MaterialOverride node and connect it as in the graph below.
  3. Select the MaterialOverride node and type 'Albedo' in the text box and choose Color in the combo box and click on Add button of a properties view.
  4. Select the MaterialOverride node and type 'Roughness' in the text box and choose Float in the combo box and click on Add button of a properties view.
  5. Change color to a bluish color and float value to 0.3.
  6. Render the image.

The sphere is now rendered with a bluish matte plastic. You can notice the sphere is diffusing light on the plane.

This RenderGraph can be explained like this :

The Tag node sphere selects the sphere in the scene, since its Tag is sphere and and the sphere primitive owns this tag. The Tag node is connected to the Shader node, which assign the Plastic material to the selection, since its Mode is 'Set Material' and Shader is Plastic. The Plastic node is connected to the MaterialOverride node and overrides the Albedo and Roughness values of the Plastic material. The MaterialOverride node is connected to the Binop override node and overrides the Matte shader assignation, since there is an active shader assignation coming in X. Etc, ...

Again the MaterialOverride place in the lower branch is not important. It could have been placed before the Plastic node without changing the meaning. What is important to understand is that if you have more than one MaterialOverride node in the branch that overrides a specific shading parameter, it is always the last MaterialOverride that is taken into account.

Tweak attributes

Let's change the smooth attribute and subdiv level on the sphere. This is done using an Attribute node. A RenderGraph Attribute node holds a subset of the attributes found in a property view of a node. Any attribute found in the node can be changed, like geometric attributes, smooth, etc.

  1. Create an Attributes node and connect it as in the graph below.
  2. Select the Attributes node and change 'Smooth > Smooth' to checked and 'Raytracing > Subdivision Level' to 1.
  3. Render the image.

The sphere is now rendered with smoothing and 1 level of subdivision. If you look good you will notice that the casted shadow on the plane is more round and less edgy than previously.

This RenderGraph can be explained like this :

In the branch that selects the sphere there is an Attributes node, which enables the 'Smooth' attribute and set the 'Level of Subdivision' attribute to 1.